<html>
    <head>
        <title>【i好邻居】{{goods.title}}</title>
        {% block headex %}
        <link rel="stylesheet" href="/static/css/browse.css" type="text/css" />
        <script type="text/javascript" src="/static/js/jquery-1.10.2.js"></script>	
        {% endblock %}
    </head>
    <body>
        <div id="article_detail" class="wrapper">
            <span class="head">
                <a href="/market/">跳骚市场</a> &gt;
                <a href="/forum/{{goods.gtype.id}}/1/">{{goods.gtype.name}}</a>
            </span>

            <span class="title"> {{goods.title}} </span> 
            <span class="meta"> {{goods.posttime}} &nbsp;{{goods.user.username}} &nbsp; 阅读数:{{goods.reads}} &nbsp;回复数:{{goods.comments}} </span>

            {% for img in goods.goodsimg_set.all %}
                <image src="/static/{{img.relative_path}}" />
            {% endfor %}
            <div class="content">
                <p>{{goods.desc}}</p>
            </div>

            <br/>
            <ul id="comments" class="comments">
                {% for c in goods.comment_set.all %}
                <li>
                <div>
                    <span>{{c.user.username}} {{c.posttime}}</span>
                    <span>
                        {{c.content}}
                    </span>
                </div>
                </li>
                {% endfor %}
            </ul>

            <input type="hidden" name="articleid" value="{{goods.id}}" />
            <textarea id="addcomment" class="addcomment" name="comment"></textarea>
            <input id="btnReply" type="submit" value="回复" />
            <script>
                $("#btnReply").click(function(){
                    $.post('/market/comment/{{goods.id}}/',
                    {'content':$("#addcomment").val()},
                    function(data, status){
                        var obj = $.parseJSON(data);
                        var html='<li><div><span>'+obj.author + '&nbsp;' + obj.posttime +
                                '</span><span>' + obj.content + '</span></div></li>';
                        $("#comments").append(html);
                        $("#addcomment").val("");
                    })
                })

            </script>

        </div>
    </body>
</html>


